#ifndef MAINWINDOW_H
#define MAINWINDOW_H

#include <QMainWindow>
#include <QSerialPort>
#include <QSerialPortInfo>
#include <QChart>
#include <QLineSeries>
#include <QSplineSeries>
#include <QValueAxis>
#include <QPieSeries>
#include <QPieSlice>
#include <QDateTimeAxis>
#include "sqldatabase.h"

QT_BEGIN_NAMESPACE
namespace Ui {
class MainWindow;
}
QT_END_NAMESPACE

class MainWindow : public QMainWindow
{
    Q_OBJECT

public:
    MainWindow(QWidget *parent = nullptr);
    ~MainWindow();
    void ReadData();
    void ReadSerial();

    void DrawDynamicPlot();
    void UpdateChartRangeMT();
    void OpenFan();
    void ColseFan();
    void Openfan_1();
    QString data_1;
    void Closefan_1();
private slots:
    void on_pushButton_4_clicked();

    void on_pushButton_2_clicked();

    void on_pushButton_clicked();

    void on_pushButton_3_clicked();

    void on_pushButton_5_clicked();

    void on_pushButton_6_clicked();

private:
    Ui::MainWindow *ui;
    QSerialPort *serial;
    qint32 status;
    qint32 temperature;
    qint32 moist;
    qint32 moduleMTCount;
    int mount;
    QLineSeries *temperatureSeries;
    QLineSeries *moistSeries;
    QChart *chartMT;
    QChart *chartRT;
    QChart *chartUV;
    qint32 xWidthMT;
    QPieSlice *sliceYou;
    QPieSlice *sliceWu ;
    QPieSlice *sliceYouFire;
    QPieSlice *sliceWuFire ;
    sqldatabase *database;
    bool serialStatus;
};
#endif // MAINWINDOW_H
